package face.pay.api.order.controller;

import face.pay.api.order.service.IOrderService;
import face.pay.util.RequestUtil;
import face.pay.util.ResultMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 *
 * 功能描述: 商户设备下单
 * @auther: zkj
 * @date: 2019/9/11 10:15
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class OrderApi {

    @Autowired
    private IOrderService orderService;

    /**
     * 统一下单接口
     * @param orderInfo
     * @return
     */
    @RequestMapping("/unify_order")
    public ResultMessage unify_order(@RequestBody String orderInfo,HttpServletRequest request){

       String ip =   RequestUtil.getIpAddress(request);
       return this.orderService.unify_order(orderInfo,ip);
    };

    /**
     * 订单查询接口
     * @param dataJson
     * @return
     */
    @RequestMapping("/checkStatus")
    public ResultMessage checkStatus(@RequestBody String dataJson){
        return this.orderService.checkStatus(dataJson);
    };








}
